package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description 申请订单状态
 * @Author WJH
 * @Date 2021/03/25
 */
public enum ApplyOrderStatus {
    WAIT_SUBMIT_DATA(0, "待提交资料"),
    WAIT_APPROVAL_DATA(1, "待审批"),
    WAIT_OUT_GUARANTEE(2, "待出函"),
    HAS_OUT_GUARANTEE(3, "已出函"),
    FINISH(4, "交易完成"),
    CANCEL(5, "交易取消"),
    ;

    /**
     * 申请订单类型
     */
    public static final Integer orderType = 1;

    private int status;
    private String desc;

    ApplyOrderStatus(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public int getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public static ApplyOrderStatus resolve(int status) {
        return Arrays.stream(values()).filter(v -> v.status == status).findFirst().orElseThrow(() -> new RuntimeException("受理订单状态值[" + status + "]有误"));
    }



}
